#include "Task.h"
SK
Task::Task()
: progress (0), state (0)
{
}
Task::~Task()
{
}

bool Task::isRunning (void)
{
    return state == 1;
}

u32 Task::getProgress (void)
{
    return progress;
}

void Task::updateProgress (u32 progress)
{
    InterlockedExchange ((LONG *)&this->progress, progress);
}

void Task::incProgress (u32 amount)
{
    u32 tmp;
    InterlockedExchange ((LONG *)&tmp, this->progress);
    tmp += amount;
    InterlockedExchange ((LONG *)&this->progress, tmp);
}

void Task::_taskStart (void)
{
    InterlockedExchange ((LONG *)&state, 1);
    this->run();
}

void Task::abort (void)
{
    InterlockedExchange ((LONG *)&state, 0);
}

EK